package com.mytaobao.main;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.mytaobao.main.weitao.dongtai.DongTaiFragment;

/**
 * Created by hp on 2017/3/30.
 */

public class TabFragmentAdapter extends FragmentPagerAdapter {


    private String[] title;

    public TabFragmentAdapter(FragmentManager fm, String[] title)
    {
        super(fm);
        this.title = title;
    }


    @Override
    public Fragment getItem(int position)
    {
        switch (position) {
            case 0:
                return new DongTaiFragment();
        }
        return new DongTaiFragment();
    }


    @Override
    public CharSequence getPageTitle(int position)
    {
        return title[position % title.length];
    }


    @Override
    public int getCount()
    {
        return title.length;
    }

}
